﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DGSFramework.Models
{
    public class StockDataDetailModel : StockBaseModel
    {
        public float? Price { get; set; }
        public int? Volume { get; set; }
        public override string GetTimeStr
        {
            get
            {
                return GetTime.Value.ToString("HH:mm:ss");
            }
        }
        public float? DM_Gia1 { get; set; }
        public int? DM_KL1 { get; set; }
        public float? DM_Gia2 { get; set; }
        public int? DM_KL2 { get; set; }
        public float? DM_Gia3 { get; set; }
        public int? DM_KL3 { get; set; }
        public float? DB_Gia1 { get; set; }
        public int? DB_KL1 { get; set; }
        public float? DB_Gia2 { get; set; }
        public int? DB_KL2 { get; set; }
        public float? DB_Gia3 { get; set; }
        public int? DB_KL3 { get; set; }
        public string GetColor
        {
            get
            {
                var result = "";
                if (DM_Gia1 < 0 && DB_Gia1 < 0)
                {
                    if (DM_KL1 > DB_KL1) //ban
                        result = "color_green"; //ban
                    else
                        result = "color_red"; //mua
                }
                else if (DM_Gia1 < 0)
                    result = "color_green"; //ban
                else if (DB_Gia1 < 0)
                    result = "color_red"; //mua
                else if (Price > DB_Gia1)
                    result = "color_green"; //ban
                else if (Price < DM_Gia1)
                    result = "color_red"; //mua
                else if (Price == DM_Gia1)
                    result = "color_red"; //mua
                else if (Price == DB_Gia1)
                    result = "color_green"; //ban
                else
                    result = "color_yellow"; //tu thoa thuan
                return result;
            }
        }

        //Dung de tim ra gia tri lon nhat --> ve chart
        public List<int> KhoiLuongList
        {
            get
            {
                var list = new List<int>();
                if (DB_KL1.HasValue)
                    list.Add(DB_KL1.Value);
                if (DB_KL2.HasValue)
                    list.Add(DB_KL2.Value);
                if (DB_KL3.HasValue)
                    list.Add(DB_KL3.Value);
                if (DM_KL1.HasValue)
                    list.Add(DM_KL1.Value);
                if (DM_KL2.HasValue)
                    list.Add(DM_KL2.Value);
                if (DM_KL3.HasValue)
                    list.Add(DM_KL3.Value);
                return list;
            }
        }

        public float? GiaThamChieuPreDate { get; set; }
    }
}


